package com.invengo.testrfid.app.utils;

import android.app.Activity;
import android.content.Context;
import android.view.View;

/**
 * Created by shengjunhao on 2017/10/31.
 */

public class MyUIUtils {

    private static MyDialogueUtils dia;

    public static void showProgressDia(Context context) {

        if (dia == null) {
            dia = new MyDialogueUtils(context);
        }
        dia.showProgressDialogue();
    }

    public static void showHorizonProgressDia(Context context) {

        if (dia == null) {
            dia = new MyDialogueUtils(context);
        }
        dia.showProgressHoriDialogue();
    }


    public static void setProgress(long percent) {

        if (dia != null) {
            dia.setProgress(percent);
        }
    }

    public static void hideProgressDia(Activity activity) {

        if (activity.isFinishing())
            return;
        if (dia != null) {
            dia.disMiss();
            dia = null;
        }
    }

    public static void hideProgressDia() {

        if (dia != null) {
            dia.disMiss();
            dia = null;
        }
    }


    public static void switchViewShow(View view) {

        if (view.getVisibility() == View.GONE) {
            view.setVisibility(View.VISIBLE);
        } else {
            view.setVisibility(View.GONE);
        }
    }
}
